

package com.hazelcast.internal.util;

/**
 * Mutable integer which can be used for counting purposes.
 * <p>
 * This class is not thread-safe.
 */
public class MutableInteger {

    /**
     * Mutable integer value of this instance.
     */
    @SuppressWarnings("checkstyle:visibilitymodifier")
    public int value;

    public MutableInteger() {
    }

    public MutableInteger(int value) {
        this.value = value;
    }

    public int getAndInc() {
        return value++;
    }

    public int addAndGet(int value) {
        this.value += value;
        return this.value;
    }
}
